﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows;
using Speakup;

namespace SpeakupUI
{
    class ControlPanel: ContentControl
    {
        private Settings Settings;
             

        private SpeakupUI2.LegendPanel Legend;
        private FilterPanel Filter;        
        private TimeSheetPanel TimeSheetPanel;
        private ClassInfoPanel ClassInfo;
        private WebPanel Web;

        public ControlPanel(ClassPanelList list, TimeSheet timeSheet)
        {
            try
            {
                Settings = Settings.Load();
            }
            catch (Exception)
            {
                Settings = new Settings();
            }
            
            Padding = new Thickness(5);
            Margin = new Thickness(3);
            Width = 250;

            Legend = new SpeakupUI2.LegendPanel();
            Legend.AvailableBrush = ClassPanel.ClassBackgrounds[ClassStatus.Available];
            Legend.AvailableWaitListBrush = ClassPanel.ClassBackgrounds[ClassStatus.AvailableWaitList];
            Legend.ReservedBrush = ClassPanel.ClassBackgrounds[ClassStatus.Reserved];
            Legend.ReservedWaitListBrush = ClassPanel.ClassBackgrounds[ClassStatus.ReservedWaitList];
            
            Filter = new FilterPanel(list);
            TimeSheetPanel = new TimeSheetPanel(timeSheet);
            ClassInfo = new ClassInfoPanel(list);
            Web = new WebPanel(Settings, timeSheet, list);


            StackPanel panel = new StackPanel();
            panel.Children.Add(ClassInfo);
            //panel.Children.Add(new SpeakupUI2.LoginPanel());
            panel.Children.Add(Web);
            panel.Children.Add(TimeSheetPanel);            
            panel.Children.Add(Filter);
            //panel.Children.Add(new SpeakupUI2.FilterPanel());            
            panel.Children.Add(Legend);
            

            ScrollViewer viewer = new ScrollViewer();
            viewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            viewer.Content = panel;

            Content = viewer;
        }

    }
}